#include <iostream>
#include <vector>
using namespace std;

class CustomStack {
  public:
    CustomStack(int maxSize) {
        max_size = maxSize;
        data = new int[max_size];
        size = 0;
    }

    void push(int x) {
        if (size == max_size) return;
        data[size] = x;
        ++size;
    }

    int pop() {
        if (size == 0) return -1;
        --size;
        return data[size];
    }

    void increment(int k, int val) {
        for (int i = 0; i < k and i < size; ++i) {
            data[i] += val;
        }
    }

    ~CustomStack() { delete[] data; }

  private:
    int max_size;
    int size;
    int *data;
};

int main() {
    CustomStack stack(3);
    stack.push(1);
    stack.push(2);
    std::cout << stack.pop() << '\n';
    stack.push(3);
    stack.push(4);
    stack.push(1);
    stack.increment(10, 1);
    stack.increment(10, 1);
    std::cout << stack.pop() << '\n';
    std::cout << stack.pop() << '\n';
    std::cout << stack.pop() << '\n';
    return 0;
}

/**
 * Your CustomStack object will be instantiated and called as such:
 * CustomStack* obj = new CustomStack(maxSize);
 * obj->push(x);
 * int param_2 = obj->pop();
 * obj->increment(k,val);
 */
